package com.dj.myapp.slice;

import com.dj.myapp.ResourceTable;
import com.dj.myapp.model.User;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Text;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

public class ScanSlice extends AbilitySlice {

    Text tv1,tv2,tv3;
    private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "MY_TAG");

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_third);

        initView();

        getData(intent);
    }

    private void initView() {
        tv1= (Text) findComponentById(ResourceTable.Id_tv1);
        tv2= (Text) findComponentById(ResourceTable.Id_tv2);
        tv3= (Text) findComponentById(ResourceTable.Id_tv3);
    }

    @Override
    public void onActive() {
        super.onActive();



    }

    private void getData(Intent data) {

        String stringParam=data.getStringParam("stringParam");
        int intParam=data.getIntParam("intParam",0);
        User user=data.getSerializableParam("user");
        tv1.setText(stringParam);
        tv2.setText(intParam+"");
        tv3.setText(user.toString());
//        HiLog.info(LABEL, intParam+"");

    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
